﻿using System;

namespace lab01
{
    internal class Program
    {
        private static void Main()
        {
            try
            {
                {
                    var sm = new SparseMatrix(10, 10);
                    MatrixRoutines.Fill(sm, 7, 10);
                    MatrixRoutines.Print(sm);

                    var ms = new MatrixStatistics(sm);
                    Console.WriteLine("Max: {0}\nMiddle: {1}\nNonz: {2}\nSum: {3}", ms.Max(), ms.Middle(), ms.Nonz(),
                                      ms.Sum());
                }

                {
                    var dm = new DenseMatrix(3, 4);
                    MatrixRoutines.Fill(dm, 7, 10);
                    MatrixRoutines.Print(dm);
                    var ms = new MatrixStatistics(dm);
                    Console.WriteLine("Max: {0}\nMiddle: {1}\nNonz: {2}\nSum: {3}", ms.Max(), ms.Middle(), ms.Nonz(),
                                      ms.Sum());
                }
            }
            catch (IndexOutOfRangeException e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}